﻿using DotConsulting.VisualStudio.BuildOutputCopy.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace DotConsulting.VisualStudio.BuildOutputCopy.View.Converter
{

    public class MessageStateToBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return Brushes.Black;
            }

            if (value is MessageState)
            {
                var realValue = (MessageState)value;
                switch (realValue)
                {
                    case MessageState.Ok:
                        return Brushes.Green;
                    case MessageState.Error:
                        return Brushes.Red;
                    default:
                        return Brushes.Black;
                }
            }
            else
            {
                return Brushes.Black;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
